package com.aiou.security.authentication.wechat;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.User;

import java.util.Collection;

/**
 * @author zyb
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class WeChatUser extends User implements WeChatUserDetails {

    private static final long serialVersionUID = 1L;
    private String openId;
    private String sessionKey;
    private String unionid;

    public WeChatUser(String username, String password, boolean enabled, boolean accountNonExpired, boolean credentialsNonExpired, boolean accountNonLocked, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, enabled, accountNonExpired, credentialsNonExpired, accountNonLocked, authorities);
    }

    public WeChatUser(String username, String password, Collection<? extends GrantedAuthority> authorities) {
        super(username, password, authorities);
    }

    @Override
    public String getOpenId() {
        return openId;
    }

    @Override
    public String getSessionKey() {
        return sessionKey;
    }

    @Override
    public String getUnionid() {
        return unionid;
    }

    @Override
    public void setOpenId(String openId) {
        this.openId = openId;
    }

    @Override
    public void setSessionKey(String sessionKey) {
        this.sessionKey = sessionKey;
    }

    @Override
    public void setUnionid(String unionId) {
        this.unionid = unionId;
    }
}